package com.atguigu.day28.work;

import sun.security.util.Length;

import java.util.GregorianCalendar;
import java.util.HashSet;
import java.util.Random;
import java.util.function.Supplier;

public class Test03 {
    public static <T> T getObj(Supplier<T> supplier) {
        return supplier.get();
    }

    public static void main(String[] args) {
        String[] arr = getObj(() -> new String[5]);
        Random random = new Random();
        HashSet<Integer> hashSet = getObj(() -> {
            HashSet<Integer> set = new HashSet<>();
            while (set.size() < 5) {
                set.add(random.nextInt(20) + 1);
            }
            return set;
        });
        System.out.println(hashSet);
        GregorianCalendar obj=getObj(()->new GregorianCalendar(2018,4,1));
        System.out.println(obj);
    }
}